package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.CheckFixedBean;
import com.sx.zongzhi.modle.CollectManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.ICheckFixedMessageView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 * 验证留守信息的pest
 */

public class CheckFixedMessagePest {

    private ICheckFixedMessageView checkMessageView;

    public CheckFixedMessagePest(ICheckFixedMessageView checkMessageView) {
        this.checkMessageView=checkMessageView;
    }


    /**
     * 检测是否存在相同号码的留守人员
     * @param orgId 网格id
     * @param idCardNo 身份证号码
     */
    public void checkFixed(String orgId, String idCardNo){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("leftBehindPeople.organization.id", orgId);
        map.put("leftBehindPeople.idCardNo",idCardNo);
        new CollectManager().checkFixed(map, new BaseCallBack<BaseResult<CheckFixedBean>>() {
            @Override
            public void onSuccess(BaseResult<CheckFixedBean> response) {
                checkMessageView.checkSuccess(response.getData());
            }
            @Override
            public void onFailures(String message) {
                checkMessageView.showError(message);
            }
        });
    }
}
